package com.collectplus.express.model;

import java.io.Serializable;

/**
 * 寄件人
 *
 * @author coffee <br>
 * 2016-11-9下午2:35:54
 */
public class SenderBean implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 3925665882255294760L;

    private int id;
    private String name;
    private String phone;
    private String province = "";
    private String city = "";
    private String district = "";
    private String provinceId;// 收件人区域编码[省]
    private String cityId; // ...市
    private String districtId;// ...区
    private String address = "";
    private String buildName = "";//建筑物名字

    public String getAddressDetails() {
        return filter(province) + filter(city) + filter(district) + filter(address);
    }

    private String filter(String str) {
        return str == null ? "" : str.trim();
    }

    //
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getDistrict() {
        return district;
    }

    public void setDistrict(String district) {
        this.district = district;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getProvinceId() {
        return provinceId;
    }

    public void setProvinceId(String provinceId) {
        this.provinceId = provinceId;
    }

    public String getCityId() {
        return cityId;
    }

    public void setCityId(String cityId) {
        this.cityId = cityId;
    }

    public String getDistrictId() {
        return districtId;
    }

    public void setDistrictId(String districtId) {
        this.districtId = districtId;
    }

    public String getBuildName() {
        return buildName;
    }

    public void setBuildName(String buildName) {
        this.buildName = buildName;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    /**
     * 设置区域相关的属性
     */
    public void copyRegion(ReceiverBean item) {
        if (item == null) {
            return;
        }
        this.setProvince(item.getProvince());
        this.setProvinceId(item.getProvinceId());
        this.setCity(item.getCity());
        this.setCityId(item.getCityId());
        this.setDistrict(item.getDistrict());
        this.setDistrictId(item.getDistrictId());
        this.setAddress(item.getAddress()+item.getBuildName());
        this.setBuildName(item.getBuildName());
    }
}
